package org.pinda.network;

import java.io.DataOutputStream;
import java.io.IOException;

import org.pinda.network.util.Stream;

public interface IPacket {
	
	/**
	 * Writes all needed data on the DataOutputStream
	 * @param outStream the OutputStream to write on
	 */
	public void write(DataOutputStream outStream) throws IOException;
	
	/**
	 * Reads all needed data from the InputStream
	 * @param inStream the InputStream to read from
	 */
	public void read(Stream inStream) throws IOException;
	
	/**
	 * Gets the packet Identifier
	 * @return the unique id for this packet
	 */
	public short getId();
	
	/**
	 * The size of the given packet<br/>
	 * Excluding the 2 bytes for the id
	 * @return the size of the packet
	 */
	public int getLength();

}
